Skip to main content

Bug Tracker

Side navigation

Ticket #3231: dataFilter[5810].diff


File dataFilter[5810].diff, 0.8 KB (added by flesler, August 07, 2008 08:38PM UTC)

This is the patch

Index: src/ajax.js
===================================================================
--- src/ajax.js	(revision 5810)
+++ src/ajax.js	(working copy)
@@ -480,14 +480,18 @@
 		if( s && s.dataFilter )
 			data = s.dataFilter( data, type );
 
-		// If the type is "script", eval it in global context
-		if ( type == "script" )
-			jQuery.globalEval( data );
+		// The filter can actually parse the response
+		if( typeof data == 'string' ){
 
-		// Get the JavaScript object, if JSON is used.
-		if ( type == "json" )
-			data = eval("(" + data + ")");
+			// If the type is "script", eval it in global context
+			if ( type == "script" )
+				jQuery.globalEval( data );
 
+			// Get the JavaScript object, if JSON is used.
+			if ( type == "json" )
+				data = eval("(" + data + ")");
+		}
+		
 		return data;
 	},

Download in other formats:

Original Format